
<?php

$title = get_input('question');
$body = get_input('OKQuestion');

$questionpost = new ElggObject();
$questionpost->subtype = "question";
$questionpost->title = $title;
$questionpost->description = $body;

$questionpost->answers = array(1 => get_input('answer1'), 2 => get_input('answer2'), 3 => get_input('answer3'), 4 => get_input('answer4'));

$questionpost->typeQuestion = get_input('typeOption');
// for now make all blog posts public
$questionpost->access_id = ACCESS_PUBLIC;

// owner is logged in user
$questionpost->owner_guid = elgg_get_logged_in_user_guid();

$question_guid = $questionpost->save();

if ($question_guid) {
    system_message("Your question was saved");
    forward("question/New");
} else {
    system_message("system can not save");
}
?>

